<?php
$page_title="Manage Site Log History - List";
	include("includes/header.php");
?>
<?
$query="select * from bkitc_log ";
$memberid=$_REQUEST["memberid"];

if($_REQUEST["fdt"]!=""){

$fdt=$_REQUEST["fdt"];
$tdt=$_REQUEST["tdt"];
$where="where date(log_date) between date('$fdt' )  and date('$tdt') ";

}else{

if($memberid!=""){
$where="where date(log_date) between date('2008-01-01')  and date(current_date()) ";
}else{

$where="where date(log_date) between date(current_date() )  and date(current_date()) ";

}

}


if($memberid!="") $where.="and user_id=".(int)$memberid;



$logInfo = qry_data($query.$where." order by log_date desc");
?>
<div class="break"></div>
<table celpadding="0" cellspacing="0" width="100%"  class="section_panel">

					<tr>
						<td >
							<form name="frmSearch" id="frmSearch">
							<div class="fleft bold" style="margin-top:4px;" >Search Log :</div>
							<div class="fleft bold" style="width:50px;text-align:right;margin-right:6px;margin-top:4px;">From </div>
							<div class="fleft"><script type="text/javascript">DateInput('from_dt', true, 'YYYY-MM-DD')</script></div>
							<div class="fleft bold" style="width:30px;text-align:right;margin-right:6px;margin-top:4px;">To </div>
							<div class="fleft"><script type="text/javascript">DateInput('to_dt', true, 'YYYY-MM-DD')</script></div> 
							<span class="fleft" >OR Enter Membership No : BKITC <input type="text" name="memberid"  size="5" value="<?=$_REQUEST["memberid"]?>"/>&nbsp;</span>
							<div class="fleft bold" style="margin-top:-3px;" ><input class="button" type="button" value="Go" onclick="showLogList(frmSearch)" /></div>
							</form>
							
						</td>
						
					</tr>
					
				</table>
<table width="100%" >
	<tr>
	<td valign="top">
		
	<table   class="table_panel" width="100%"  cellspacing="0" cellpadding="4">
	<tr  align="left">
	<th width="5">S.No</th>

	<th>Date</th>
	<th>Log User</th>
	<th>Remarks</th>
	<th>IP Address</th>

	
	<th width="71px">View</th>
	</tr>
	<? foreach($logInfo as $i=>$logdata) {?>

	<tr <?if($i%2==0) echo 'class="white_bg"'; else echo 'class="grey_bg"' ?>>
	<td><?=$i+1;?></td>
	
	<td><?=$logdata["log_date"];?></td>
	<td><?=$log_types[$logdata["user_type"]];?></td>



	<td><?=$logdata["log_remarks"]?></td>
	<td><?=$logdata["ip_address"]?></td>
	
	<td>
	<a  href="view_log.php?mode=edit&log_id=<?=$logdata["log_id"];?>">View</a> 

	</td>
	</tr>
	
	<? } ?>
	</table>
	
	</td>
	</tr>
	
	</table>

<?php include("includes/footer.php"); ?>

<script>
function showLogList(vfrmSearch){
location.href="site_log.php?fdt=" + vfrmSearch.from_dt.value + "&tdt=" + vfrmSearch.to_dt.value + "&memberid=" + vfrmSearch.memberid.value;
}

</script>
